package unit2;

import java.util.Scanner;
public class Ex2_17_Average {
    public static void main(String[] args) {
        float score[] = new float[30];
        int x;
        float sum = 0;
        Scanner in = new Scanner(System.in);
        System.out.print("输入30个学生的成绩：");
        //以下输入30个学生的成绩存入数组score中
        for (int k = 0; k < 30; k++)
            score[k] = in.nextFloat(); //成绩存入数组
        // 以下计算平均成绩
        for (int k = 0; k < 30; k++)
            sum += score[k];
        System.out.println("平均成绩为：" + sum / 30);
    }
}
